<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="../../component/pear/css/pear.css"/>
    <style>
        .layui-form-label{
            width: 130px;
        }
        .layui-input-block{
            margin-left: 160px;
        }
    </style>
</head>
<body>
<form class="layui-form" action="" style="padding-right: 30px">
    <input type="hidden" name="id" value="${busUnit.id!}">
    <div class="main-container">
        <div class="layui-form-item">
            <div class="layui-col-xs12">
                <label class="layui-form-label required">企业名称</label>
                <div class="layui-input-block">
                    <input type="text" name="enterpriseName" required lay-verify="required" placeholder="" autocomplete="off"
                           class="layui-input" value="${busUnit.enterpriseName!}">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-col-xs6">
                <label class="layui-form-label required">法人姓名</label>
                <div class="layui-input-block">
                    <input type="text" name="legalName" required lay-verify="required" placeholder="" autocomplete="off"
                           class="layui-input" value="${busUnit.legalName!}">
                </div>
            </div>
            <div class="layui-col-xs6">
                <label class="layui-form-label">法人电话</label>
                <div class="layui-input-block">
                    <input type="text" name="legalPhone" required lay-verify="" placeholder="" autocomplete="off"
                           class="layui-input" value="${busUnit.legalPhone!}">
                </div>
            </div>


        </div>
        <div class="layui-form-item">
            <div class="layui-col-xs6">
                <label class="layui-form-label required">是否为负面清单</label>
                <div class="layui-input-block">
                    <input type="radio" name="negativeState" value="1" title="否" if(${(busUnit.negativeState!)}==''){ checked } ${(busUnit.negativeState!)=='1'?'checked':''}>
                    <input type="radio" name="negativeState" value="0" title="是" ${(busUnit.negativeState!)=='0'?'checked':''}>
                </div>
            </div>
            <div class="layui-col-xs6">
                <label class="layui-form-label required">社会统一信用代码</label>
                <div class="layui-input-block">
                    <input type="text" name="creditCode" required lay-verify="required" placeholder="" autocomplete="off"
                           class="layui-input" value="${busUnit.creditCode!}">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-col-xs6">
                <label class="layui-form-label required">准入状态</label>
                <div class="layui-input-block">
                    <input type="radio" name="accessStatus" if(${(busUnit.accessStatus!)}==''){ checked } ${(busUnit.accessStatus!)=='0'?'checked':''} value="0" title="有效">
                    <input type="radio" name="accessStatus" ${(busUnit.accessStatus!)=='1'?'checked':''} value="1" title="无效">
                </div>
            </div>
            <div class="layui-col-xs6">
                <label class="layui-form-label required">受理单位</label>
                <div class="layui-input-block">
                    <input type="text" name="acceptanceUnit" required lay-verify="required" placeholder="" autocomplete="off"
                           class="layui-input" value="${busUnit.acceptanceUnit!}">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-col-xs6">
                <label class="layui-form-label required">是否为黑名单</label>
                <div class="layui-input-block">
                    <input type="radio" name="blackList" value="1" title="否" if(${(busUnit.blackList!)}==''){ checked } ${(busUnit.blackList!)=='1'?'checked':''}>
                    <input type="radio" name="blackList" value="0" title="是" ${(busUnit.blackList!)=='0'?'checked':''}>
                </div>
            </div>
            <div class="layui-col-xs6">
                <label class="layui-form-label">安全积分</label>
                <div class="layui-input-block">
                    <input type="text" name="safetyPoints" required lay-verify="" placeholder="" autocomplete="off"
                           class="layui-input" value="${busUnit.safetyPoints!}">
                </div>
            </div>
        </div>
        <div class="bottom">
            <div class="button-container">
                <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
                        lay-filter="user-save">
                    <i class="layui-icon layui-icon-ok"></i>
                    提交
                </button>
                <button type="reset" class="pear-btn pear-btn-sm" lay-filter="close">
                    <i class="layui-icon layui-icon-refresh"></i>
                    重置
                </button>
            </div>
        </div>
    </div>
</form>
<script src="../../component/layui/layui.js"></script>
<script src="../../component/pear/pear.js"></script>
<script>
    layui.use(['form', 'jquery'], function () {
        let form = layui.form;
        let $ = layui.jquery;
        let VIEW_PATH = "${ctxPath}/busUnit/view/";
        let DATA_PATH = "${ctxPath}/busUnit/data/";
        form.on('submit(user-save)', function (data) {
            $.ajax({
                url: DATA_PATH + 'saveOrUpdate',
                data: JSON.stringify(data.field),
                dataType: 'json',
                contentType: 'application/json',
                type: 'post',
                success: function (result) {
                    if (result.code == 0) {
                        layer.msg("操作成功", {icon: 1, time: 1000}, function () {
                            parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                            parent.layui.table.reload("busUnit-table");
                        });
                    } else {
                        layer.msg("操作失败", {icon: 2, time: 1000});
                    }
                }
            })
            return false;
        });
        form.on()

    })
</script>
<script>
</script>
</body>
</html>